package com.zoro.barn.commons.foundation.entity;

import com.zoro.barn.commons.foundation.web.PageRequestInterface;

/**
 * @author zhaoxingwu
 */
abstract class BaseEntity implements PageRequestInterface {

    private int current = 0;
    private int pageSize = 0;

    private boolean page = false;

    @Override
    public int getCurrent() {
        return current;
    }

    public void setCurrent(int current) {
        this.current = current;
        this.page = this.current > 0 && this.pageSize > 0;
    }

    @Override
    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
        this.page = this.current > 0 && this.pageSize > 0;
    }

    @Override
    public boolean isPage() {
        return page;
    }

    public void setPage(boolean page) {
        this.page = page;
    }
}
